package com.zang.im.croom;

import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo;
import com.zang.im.croom.netty.EchoServer;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;

import java.util.Arrays;

/**
  * @author ZhangQiang
  *
  */
@EnableDubbo
@SpringBootApplication
public class ImServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(ImServerApplication.class, args);
        EchoServer echoServer = new EchoServer();
        echoServer.run();
    }

    @Bean
    public static CommandLineRunner commandLineRunner(ApplicationContext context){
        return args -> {
            System.out.println(" 启动注入：");
            String[] names = context.getBeanDefinitionNames();
            Arrays.sort(names);
            for(String n : names){
                System.out.println("name:" + n);
            }
        };
    }


}